﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using TNCGameEngine;
using TNCGameEngine.Content;

namespace SpaceAdventureLib.Universe.Weapons
{
    public class Bullet : Ammo
    {

        #region "Properties"


        #endregion

        #region "Variables"

        private static Model model = null;

        #endregion

        #region "Constructors"

        public Bullet(Weapon weapon)
        {

            this.PreInitialize(weapon.Space);

            this.Velocity = new Vector3(3000);
            this.Model = Bullet.model;
            this.LifeSpan = 15;

        }

        #endregion

        #region "General Methods"

        public override void FinaliseInitialization()
        {
            // do nothing
        }

        public override List<AssetToLoad> GetAssetsToLoad()
        {
            return new List<AssetToLoad>();
        }

        public override void LoadContent(ContentLoader loader)
        {
            // do nothing
        }

        public override void UnloadContent(SharedContentManager content)
        {
            // do nothing
        }

        public static new List<AssetToLoad> GetCommonAssetsToLoad()
        {
            List<AssetToLoad> list = new List<AssetToLoad>();
            list.Add(new AssetToLoad("Weapons\\ammo", typeof(Model)));
            return list;
        }

        public static new void LoadCommonContent(ContentLoader loader)
        {
            Bullet.model = loader.GetContent<Model>("Weapons\\ammo");
        }

        public static new void UnloadCommonContent(SharedContentManager content)
        {
            if (Bullet.model != null)
            {
                content.UnloadSingleContent(Bullet.model);
            }
        }

        #endregion

        #region "Methods"

        protected override void UpdateMovement(GameTime gameTime)
        {

            float dt = (float)gameTime.ElapsedGameTime.TotalSeconds;
            this.Move(dt * this.Velocity);

        }

        protected override void UpdateExplosion(GameTime gameTime)
        {
            // TODO: do nothing
        }

        protected override void DrawMovement(Camera camera, GraphicsDevice graphics)
        {
            this.DrawModel(camera, Bullet.model, this.World);
        }

        protected override void DrawExplosion(Camera camera, GraphicsDevice graphics)
        {
            // TODO: do nothing
        }


        #endregion

    }
}
